package com.example.task.handler;

import android.os.Handler;
import android.os.Message;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;

public final class TalkHandler extends Handler {

    private final TextView textView;
    private final Button button;

    public TalkHandler(TextView textView, Button button) {
        this.textView = textView;
        this.button = button;
    }


    @Override
    public void handleMessage(@NonNull Message msg) {
        super.handleMessage(msg);
        String info= (String) msg.obj;
        if (msg.what==1){
            textView.setText(info);
            button.setText("取消报名");
        }else if(msg.what == 2){
            textView.setText(info);
            button.setText("报名");
        }else if(msg.what == 3){
            textView.setText(info);
        }
    }
}
